<html>
<head>
<link href="../../../Objects/sofa_white.css" rel="stylesheet" type="text/css" />
</head>
<body>
	<div id="contenu">
		
		<center><h3>Shadowing (5/7)</h3>
		  <br><br>
		  <img src="4_Visual.png" name="Visu_start" align="middle" width=300>
		</center>

		
		<br><div id="orangeText">Description</div>
        
		<p>Casting shadows in SOFA.</p>
        
		<div id="orangeText">Key points</div>
        
		<p>With <b>SpotLight</b>, it is possible to cast shadows simply in SOFA.
		All we have to do is to put the component <b>OglShadowShader</b> (Shaders in general will be seen later), preferably 
		in the same Node as the <b>LightManager</b>, i.e. root node of the scene.</p>
        
        <div id="tutorialAction"><p>First, add a floor by adding a new <strong>OglModel</strong> to the <strong>Dragon</strong> node and setting the <strong>Path to the model</strong> to <strong>/Sofa/share/mesh/floor.obj</strong>. Set its <strong>position</strong> to (0 -7 0).</p>
        
        <p>Add a new <strong>Spotlight</strong> to the <strong>Root</strong> node. Set its <strong>position</strong> to (0 60 0) and its <strong>direction</strong> to (0 -1 0.01).</p></div>
        
        <p>Add a <strong>OglShadowShader</strong> component to the <strong>Root</strong> node.
        
		<p>Then, you just have to either type the <strong>CONTROL+'L'</strong> key combination, or set the parameter <i>Enable Shadow in the scene</i> to true in the <strong>LightManager</strong>.</p>
		
		<p>The only remarkable parameter is <strong>shadowTextureSize</strong>. The higher this parameter is, the nicer the shadow will be. Be careful with this, because if it is too high it can slow down your computer or even freeze it. It can be considered that 4096 is the maximum reasonable value.</p>
		
		<div id="orangeText">Note:</div>
		<p>For now, shadows are rendered "hardly" (contours are raw).
		Don't forget that it uses GPU quite badly, so try to activate shadows only when necessary. 
		</p>
		
        <br><center><h3><a href="5_Visual.scn">Next</a></center></h3>
	</div>
</body>
</html>
